package com.aitoedu.server.service.impl;

import cn.dev33.satoken.stp.StpUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.aitoedu.server.entity.Teacher;
import com.aitoedu.server.service.TeacherService;
import com.aitoedu.server.mapper.TeacherMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;

/**
 * @author 曹正豪
 * @description 针对表【teacher(教师信息)】的数据库操作Service实现
 * @createDate 2024-08-26 23:43:01
 */
@Service
public class TeacherServiceImpl extends ServiceImpl<TeacherMapper, Teacher>
    implements TeacherService{

    @Autowired
    private TeacherMapper teacherMapper;

    @Override
    public Teacher pl() {
        Long tid = Long.valueOf((String) StpUtil.getLoginId());
        Teacher teacher = teacherMapper.selectById(tid);
        if(ObjectUtils.isEmpty(teacher)) return new Teacher();
        teacher.setPassword("******");
        return teacher;
    }
}




